package com.xiaoshuidi.cloud.module.contract.enums.bill;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 资金流向
 */
@Getter
@AllArgsConstructor
public enum OrderFeeFlowTypeEnum {
    INFLOW(0,"流入"),
    OUTFLOW(1,"流出");
    private final Integer code;
    private final String name;

    private static Map<Integer, OrderFeeFlowTypeEnum> enumMap = new HashMap<>();
    static {
        OrderFeeFlowTypeEnum[] values = OrderFeeFlowTypeEnum.values();
        for (OrderFeeFlowTypeEnum value : values) {
            enumMap.put(value.getCode(), value);
        }
    }
    public static OrderFeeFlowTypeEnum getEnum(Integer num){
        return enumMap.get(num);
    }

    public static OrderFeeFlowTypeEnum getOrderFeeFlowTypeEnumByCode(Integer code) {
        OrderFeeFlowTypeEnum[] orderFeeSortTypeEnums = values();
        for (OrderFeeFlowTypeEnum flowTypeEnum : orderFeeSortTypeEnums) {
            if (flowTypeEnum.code==code) {
                return flowTypeEnum;
            }
        }
        return null;
    }
}
